package com.cytech.cloudclinic.moudle.main.clinic.admission.diagnosis;

import com.cytech.cloudclinic.base.BaseBean;
import com.cytech.cloudclinic.base.BaseObserver;
import com.cytech.cloudclinic.base.BasePresenter;
import com.cytech.cloudclinic.bean.Action;
import com.cytech.cloudclinic.bean.Illness;
import com.cytech.cloudclinic.bean.req.BasePage;
import com.cytech.cloudclinic.bean.req.ReqDiagnosis;
import com.yechaoa.yutils.ToastUtil;

import java.util.List;

public class DiagnosisPresenter extends BasePresenter<DiagnosisView> {
    public DiagnosisPresenter(DiagnosisView baseView) {
        super(baseView);
    }

    /**
     * 获取疾病列表
     */
    void getActionList(ReqDiagnosis diagnosis,boolean isFirstMenu) {
        addDisposable(apiServer.getActionList(objectToRequestBody(diagnosis)), new BaseObserver<BaseBean<List<Action>>>(baseView, false) {

            @Override
            public void onSuccess(BaseBean<List<Action>> o) {
                if(isFirstMenu){
                    baseView.getMenuListSuccess(o.result);
                } else{
                    baseView.getActionContentSuccess(o.result);
                }

            }

            @Override
            public void onError(String msg) {
                ToastUtil.showToast(msg);
            }
        });
    }
}
